{include file="public/toper" /}
<div class="x-nav">
    <span class="layui-breadcrumb">
        <a href="">结算中心</a>
        <a href="">结算订单</a>
    </span>
    <a class="layui-btn layui-btn-small" style="line-height:1.6em;margin-top:3px;float:right" href="javascript:location.replace(location.href);" title="刷新"><i class="layui-icon" style="line-height:30px">&#xe666;</i></a>
</div>
<div class="x-body">
    <div class="layui-row">
        <div class="layui-form layui-col-md12 x-so">
            <input type="text" name="sreach" value=""  style="width:250px;" id="key"   placeholder="编号/费用" autocomplete="off" class="layui-input">
            <div class="layui-input-inline">
                <select name="type" id="type">
                    <option value=".">全部</option>
                    <option value="0">未付款</option>
                    <option value="1">已付款</option>
                </select>
            </div>
            <button class="layui-btn" id="search"><i class="layui-icon">&#xe615;</i></button>
        </div>
    </div>
    <table class="layui-hide" id="test" lay-filter="test"></table>
</div>
<script type="text/html" id="sj">
    {{#  if(d.pay_time==0){ }}无{{#  } else { }}<div>{{layui.util.toDateString(d.pay_time*1000)}}</div>{{#  } }}
</script>
<script type="text/html" id="action">
    {{#  if(d.pay_state==1){ }}
    <button class="layui-btn layui-btn layui-btn-xs"  onclick="x_admin_show('查看商家结算','{:url(\'admin/Sett/see\')}?id={{d.settlement_id}}')">查看</button>
    {{# } }}
</script>

<script>
    layui.use(['table','util'], function(){
        var table = layui.table, $ = layui.jquery;
        var layer = layui.layer;
        var loading = layer.load(1, {shade: [0.1,'#fff'] });
        var tableIn = table.render({
            method: 'post',
            elem: '#test'
            ,url: "{:url('Sett/index2')}"
            ,id:'test'
            ,cols: [[
                {field:'settlement_id', width:80, title: '序号',align: 'center',type:'numbers'}
                ,{field:'settlement_sn',width: 200,title: '结算编号', align: 'center'}
                // ,{field:'name',width: 200,title: '申请门店', align: 'center'}
                ,{field:'orderid',width: 150,title: '结算订单数', align: 'center'}
                ,{field:'fees', width:140, title: '结算费用',align: 'center'}
                ,{field:'pay_charge', width:140, title: '支付费用',align: 'center'}
                ,{field:'add_time',width: 180,title: '申请时间', align: 'center',templet: '<div>{{layui.util.toDateString(d.add_time*1000)}}</div>'}
                ,{field:'pay_state', width:100, title: '状态',align: 'center',templet: function(d){if(d.pay_state==0){ return '未付款';}else if (d.pay_state==1){ return '已付款';}}}
                ,{field:'pay_time',width: 180,title: '付款时间', align: 'center',templet: '#sj'}
                ,{width: 140,title: '操作', align: 'center', toolbar: '#action'}
            ]]
            ,page: true
            ,limit: 30
            ,limits:[30,60,90,120,150,180,210,240,270,300]
        });
        layer.close(loading);


        $('#search').on('click', function () {
            tableIn.reload({
                where: {key: $('#key').val(),type:$('#type').val()}
                ,page: {curr: 1 }
            });
        });
    });
</script>
{include file="public/footer"/}